Performing operations by a first functionality within a second functionality in a same or in a different programming language

ABSTRACT

A method, system, and computer readable medium for a first functionality in a programming language to perform operations within a second functionality in the programming language or in a different programming language comprises creating an adapter object for the second functionality, binding the adapter object within a naming service, looking-up a proxy object for the adapter object, and calling the second functionality through the proxy object by the first functionality.

CROSS REFERENCE TO RELATED APPLICATIONS

This patent application is related to pending U.S. patent application Ser. No. 10/975,623, entitled CREATING A PROXY OBJECT AND PROVIDING INFORMATION RELATED TO A PROXY OBJECT, and to pending U.S. patent application Ser. No. 10/975,827, entitled CALLING A SECOND FUNCTIONALITY BY A FIRST FUNCTIONALITY, which are incorporated by reference herein, assigned to the assignee of this patent application, and were filed on an even date herewith.

BACKGROUND OF THE INVENTION

The present invention is related to performing operations in a programming language, and, more specifically to performing operations by a first functionality in a programming language within a second functionality in the programming language or in a different programming language.

According to the present invention, an architect console is utilized through which at least one proxy and adapter are provided to a selected source. The architect console analyzes source code, methods within classes that will be exposed are selected, and mapping and various generation options for those methods are provided. The analyzing allows a database of classes, methods, and fields to be built. Based on a received command, all of the proxies, adapters and streamers that will be needed to perform invocations (for example, remote invocations) are generated in an appropriate source language. For example, if a server associated with JAVA code whose functionality is to be exposed to a C++ client, then JAVA adapters are generated for the server, and C++ source code proxies are generated for the client.

Within the proxy of the present invention, initialization code, at least one proxy method, and at least one lookup method exist. The initialization code registers a type of that proxy within the run time, and registers method streamers used to marshal and unmarshal arguments, and return values passed during remote invocations. The proxy methods have the same signature as the business method of the object that is being exposed. As such, the client “believes” that it is accessing the business object directly but it is really invoking the business object through the proxy. The lookup method is called by the client in order to acquire a proxy that is found in a naming service.

Within the adapter of the present invention, at least one bind method, and an invoke method, exist. The bind method can be called to register an adapter in the naming service, while the invoke method, which will be called by the run time, will dispatch the invocation to the appropriate business method.

A problem exists in the current art of effectively and efficiently acquiring an initial remote reference to a remote object. In order to do so, the present invention comprises a naming service that binds an object into a well known name, and a client that uses that well known name to acquire a proxy to the object in as few steps as possible.

SUMMARY OF THE INVENTION

The present invention overcomes prior art problems and limitations by performing operations by a first functionality in a programming language within a second functionality in the programming language or in a different programming language. The present invention requires a minimal amount of code to start up its run time environment and to call the necessary methods that provide a proxy which can be used as though it were the actual business object.

In one embodiment, a method for a first functionality in a programming language to perform operations within a second functionality in the programming language or in a different programming language comprises creating an adapter object for the second functionality, binding the adapter object within a naming service, looking-up a proxy object for the adapter object, and calling the second functionality through the proxy object by the first functionality.

In another embodiment, a method for a first functionality in a programming language to perform operations within a second functionality in the programming language or in a different programming language comprises creating an adapter object for the second functionality, binding the adapter object to a URL, looking-up a proxy object for the adapter object based on the URL, and calling the second functionality through the proxy object by the first functionality.

In a further embodiment, a computer readable storage medium comprises instructions for creating an adapter object for a second functionality, binding the adapter object within a naming service, wherein the binding associates the adapter object to a URL, looking-up a proxy object for the adapter object based on the URL, providing the proxy object to a first functionality, and calling the second functionality through the proxy object by the first functionality.

In yet another embodiment, a system for performing operations by a client in a programming language within a server in the programming language or in a different programming language comprises a server, and a client operably coupled to the server, wherein the system comprises means for creating an adapter object for the server, binding the adapter object within a naming service, looking-up a proxy object for the adapter object, and calling the server through the proxy object by the client.

In yet a further embodiment, a system for performing operations by a client in a programming language within a server in the programming language or in a different programming language comprises an adapter object created for the server and bound within a naming service, and the server called by the client through a proxy object for the adapter object.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 depicts a flow diagram of a client performing a remote invocation in accordance with a preferred embodiment of the present invention; and

FIG. 2 depicts a flow diagram of a server responding to the client performing the remote invocation in accordance with a preferred embodiment of the present invention.

DETAILED DESCRIPTION OF THE INVENTION

FIG. 1 depicts a flow diagram 10 of a client 12 performing a remote invocation. A method 14 a in a business object 16 is called on the client 12 and the business object 16 performs a remote invocation within that method 14 a. A proxy method 14 is called on a proxy 18 passing various arguments. The proxy 18, which is generated by an architect console (not shown), calls a super class invoke method (not shown) which performs an invoke method 20 on a reference holder 22. The reference holder 22 is an object that contains information necessary to perform the remote invocation in terms of having the address of the object, being able to acquire a connection to it and sending the data to a server side (not shown) using that connection.

When a remote reference is acquired, either by performing a lookup (described further below) or as the result of the server returning a remote reference through another invocation, the reference information is encapsulated in data that is passed back to the client. The client then uses the information to create the address information, the reference holder and reference, and proxy, to be able to perform that invocation. The present invention includes a two-layer design for the reference information in that multiple protocols are supported. The reference holder 22 contains the information that is necessary for performing any kind of remote invocation. Protocol specific references 24, such as IRMP reference, SOAP reference, the JAVA run time, and others, are further supported by the present invention. These references 24 provide the mechanism to perform communication in the appropriate messaging protocol for that type of reference. For example, a SOAP reference takes an invocation consisting of the proxy 18 which is being invoked on, and the arguments. A connection 32 (such a TCP connection) to the server is acquired 30 (via a transport 28) based on the address of the proxy 18 that is being invoked on. The message is then sent 34 in the appropriate protocol via the connection 32 and a response 36 from the connection is received.

The appropriate protocol for a reference is decided upon when a lookup is performed or when a remote invocation returns a remote reference. During such instances, information is received, such as the address information, that is used to create a reference of the appropriate type. In the case of a lookup, part of the information that is passed includes the naming protocol to use. The naming protocol is associated with a messaging protocol.

If a server is returning a remote reference to the client as part of an invocation, and since the remote reference is going to be processed by a SOAP reference or an IRMP reference, for example, the server will already know this fact. In a naming service, when a lookup is performed, information is passed that is in a URL format. For example, an irmp://host:port/name URL would be passed to perform a lookup in the IRMP protocol. When a reference (IRMP or SOAP, for example) sends the invocation out across the network, it marshals the arguments in the appropriate protocol format (IRMP or SOAP), and sends any other necessary information to perform the invocation across the network to the server. Using the message streamer registered in the proxy initialization code, the argument types that are being passed can be ascertained and those streamers are able to marshal the argument of that type in the appropriate protocol. As such, streamers for native primitive object types (such as integer and string for both IRMP and SOAP) exist and if custom types exist that will be passed back and forth, then streamers for those types would be present as well. When a response is received, any objects that were returned by the server are unmarshaled using the appropriate streamer.

The initialization code for the proxy consists of registering a type within the run time and registering method streamers for every method that the proxy exposes. The type is the unique string that uniquely identifies that type. This allows the distributed system of the present invention to be cross-language and permits the mapping from a generic cross-language type to the appropriate language-specific type.

Referring now to FIG. 2, a flow diagram 40 of a server 42 responding to the client 12 performing the remote invocation is depicted. A request manager 44, which is associated with the connection 32, is adapted to receive incoming invocations via the connection. When the request manager 44 begins to receive an incoming invocation, it inquires as to the ability of each request handler 46 (which is protocol specific and is a counter-part to the client side protocol specific reference 24) to process 48 the incoming invocation. If a request handler 46 is able to process the invocation, the connection is handed off to the appropriate request handler 46. The request handler 46 receives the incoming invocation from the connection 32 and reads the request off of the stream. In other words, the request handler 46 is reading the data off the socket and turning it into actual invocation data that is going to be processed. The request handler 46 uses streamers as the client 12 with an exception that where the client is streaming language-specific objects to protocol-specific data, the streaming occurs from protocol-specific to language-specific. In addition, the streamers may have been in a different language to the client side streamers, for example Java instead of C++. The invocation includes information such as the arguments and other information that is necessary to uniquely resolve the object that will be invoked and perform the invocation.

Once this information is received, an adapter 58 for that object is obtained from an ORB server 54 that maintains a mapping between an object ID and the adapter for that object. Based on the foregoing, the adapter that is going to be invoked is determined. The request handler 46 performs an invocation 56 which is received by the adapter 58 which is comprised of code generated from the architect console. The code, based on the operation that is being performed, calls a particular method 60 on the actual business object 62. At this point, the actual business method is called with the arguments and performs a particular operation such as, for example, transferring money from one account to another account. A response 64 is returned to the client 12 via the request handler 46 and the connection 32. The client decodes the response 64 concluding the remote invocation.

In one embodiment of the present invention, a method for a first functionality (such as a client) in a programming language to perform operations within a second functionality (such as a server) in the programming language or in a different programming language comprises creating an adapter object for the second functionality, binding the adapter object within a naming service, looking-up a proxy object for the adapter object, and calling the second functionality through the proxy object by the first functionality. The second functionality can also be called through the adapter by the first functionality. The binding includes associating the adapter object to a URL within the naming service.

The adapter object further includes means to call the second functionality, wherein the second functionality is a business object, and wherein the business object consists of at least one operation. The means to call the second functionality includes at least one of: mapping a required name of the operation to the operation, and calling the operation with optional information to be passed to the operation, wherein the information includes arguments to the operation, and wherein the operation is a business method.

The adapter object and the second functionality are instances of classes, wherein the classes are in the same programming language. Further, the proxy object and the first functionality are instances of classes, wherein the classes are in the same programming language.

In a further embodiment, a computer readable storage medium comprises instructions for creating an adapter object for a second functionality, binding the adapter object within a naming service, wherein the binding associates the adapter object to a URL, looking-up a proxy object for the adapter object based on the URL, providing the proxy object to a first functionality, and calling the second functionality through the proxy object by the first functionality. The computer readable storage medium further comprises performing operations by the first functionality in a programming language within a second functionality in the programming language or in a different programming language.

The discussion will now center on how a lookup is performed via the client 12 to resolve the appropriate type of messaging protocol that will be used. Although not depicted, the client 12 can perform the lookup to obtain the proxy within the business object itself or elsewhere and then provide the proxy to the business object. When the proxy's lookup method passes in the URL format (consisting of an optional scheme-specific portion and a required scheme-specific portion), a client side naming service extracts the scheme, looks up a client side naming service using that scheme and then passes the lookup to that client type naming service. Effectively, a naming service interface exists which includes the aforementioned lookup method (as well as other methods) and implementations of the naming service (such as the IRMP naming service and the SOAP naming service, for example) which provide the implementation of that lookup using the messaging protocol associated with that naming service. For example, if an IRMP naming service is being used to perform a lookup, the IRMP naming service performs a remote invocation using the IRMP protocol to obtain the remote reference to that object.

This remote invocation is a static invocation whereby a name space class exists on a server as well as on the client. The name space class contains static methods for naming service operations including, lookup, bind, unbind, and rebind, as well as a registry of naming services. As such, when a lookup is performed, the name space class resolves the appropriate naming service and then hands off the lookup invocation to that naming service. The remote invocation is unique as it provides a simple, single point of entry for all naming service operations. In contrast, systems including an object request broker require a plurality of steps to be taken before naming service type operations can occur. The present invention provides the static methods directly through the name space class. The use of static methods allows a lookup to be performed in as few steps as possible.

Once the server receives the lookup operation (utilizing the name space class), it extracts the scheme and then hands off the invocation to the IRMP naming service. The URL, which is local to this process and includes the scheme which is used by the name space to get the appropriate naming service, is received by a directory which returns the actual proxy back to the client via the previously described mechanism.

The naming service is a combination of a naming and directory service, which is capable of being federated across multiple processes. Using the IRMP naming service as an example, if a lookup is performed on the URL irmp://server/hotels/Dallas/Radisson, the portions of the URL include a scheme (irmp) as well as scheme specific portions including a host (server), a path (hotels/Dallas), and a name (Radisson). Once the host is reached, the rest of the URL is passed to the directory which breaks the rest of the URL down into individual components. Let us assume that within the server (the primary server) a directory of hotels exists and that another server, which is running in Dallas, includes a directory called Dallas. When the server in Dallas is initiated, it starts up its directory and binds that directory into the primary server. Therefore, looking at the actual objects on the server, a directory with the name hotels exists with a directory proxy positioned beneath it with the name of Dallas. When the top level hotels directory receives a lookup, it is broken up with the rest of the URL passed off to the directory proxy. Since the Dallas directory is a proxy, it will perform a remote invocation to the server in Dallas which actually includes the Radisson name beneath it. Thus, the proxy is returned from the server to the client via the primary server.

A federated naming service is thus provided where a client only needs to know a URL or a host of the primary server. Service for every city can then be bound into either of those references transparently to the client. Basically, the business object is bound to the bind method which creates an adapter wrapping that business object and binds the adapter into the naming service. Similarly, the server that starts up in Dallas includes an indicator (via, for example, software) that is aware of the primary server. However, the code that binds the Radisson Hotel beneath Dallas only needs to be aware of the directory which it binds itself into regardless of where that directory is actually located. When the server performs a bind to an adapter (such as a bind to server/hotels/Dallas/Radisson), it needs to know the full path but it does not need to know that Dallas is actually being hosted on a server in Dallas.

Although an exemplary embodiment of the system, method, and computer readable storage medium of the present invention has been illustrated in the accompanied drawings and described in the foregoing detailed description, it will be understood that the invention is not limited to the embodiments disclosed, but is capable of numerous rearrangements, modifications, and substitutions without departing from the spirit of the invention as set forth and defined by the following claims. For example, the capabilities of the client 12 and/or the server 42 can be performed by one or more modules in a distributed architecture and on or via any device able to transfer information between the client and the server. Further, the functionality performed by the elements within the client 12 and/or the server 42 may be performed by one or more of the elements such as the reference holder 22 or the request handler 46. 

1. A method for a first functionality in a programming language to perform operations within a second functionality in the programming language or in a different programming language, the method comprising: creating, on a computing device, an adapter object for the second functionality, the second functionality including a business object; binding the adapter object to a URL within a naming service, wherein binding utilizes a name space class, effective to enable a proxy object to access the adapter object, wherein the adapter object wraps the business object; receiving, with the adapter object, a call from the first functionality through the proxy object; and registering both an object type within a run time and a method streamer for a method exposed by the proxy object to allow mapping from a generic cross-language type to a language-specific type, the object type comprising a unique string to identify the object type; responsive to receiving the call, calling the second functionality using the adapter object.
 2. The method of claim 1, wherein creating an adapter object includes creating an adapter object for the business object.
 3. The method of claim 2, wherein creating an adapter object for the business object comprises creating the adapter object for the business object that facilitates at least one operation.
 4. The method of claim 1, wherein creating an adapter object includes creating an adapter object that is configured to call the second functionality by at least: mapping a name of an operation to the operation prior to receiving a call from the proxy object; and calling the operation with optional information to be passed to the operation.
 5. The method of claim 4, wherein calling the operation includes calling the operation with optional information that includes arguments to the operation.
 6. The method of claim 5, wherein calling the operation includes calling a business method.
 7. The method of claim 1, wherein creating an adapter object for the second functionality includes creating instances of classes.
 8. The method of claim 7, wherein creating instances of classes includes creating instances of classes that are in the same programming language.
 9. The method of claim 1, wherein receiving a call from the first functionality through the proxy object includes receiving a call from instances of classes.
 10. The method of claim 9, wherein receiving a call from instances of classes includes receiving a call from instances of classes that are in the same programming language.
 11. The method of claim 1, wherein the binding comprises associating the adapter object to a URL within the naming service.
 12. A method for a first functionality in a programming language to perform operations within a second functionality in the programming language or in a different programming language, the method comprising: creating, on a computing device, an adapter object for the second functionality, wherein the adapter object is configured to call the second functionality by mapping a name of an operation to the operation prior to receiving a call from a proxy object, the proxy object configured to register both an object type within a run time and a method streamer for a method exposed by the proxy object to allow mapping from a generic cross-language type to a language-specific type, the object type comprising a unique string to identify the object type; binding the adapter object to a URL, wherein binding utilizes a name space class, effective to enable the proxy object to access the adapter object; receiving, with the adapter object, a call from the first functionality through the proxy object; and responsive to receiving the call, calling the second functionality using the adapter object.
 13. A computer readable storage medium comprising instructions which, responsive to execution on a computing device, cause the computing device to perform operations comprising: creating an adapter object for a second functionality, wherein the adapter object is configured to call the second functionality by mapping a name of an operation to the operation prior to receiving a call from a proxy object, the proxy object configured to register both an object type within a run time and a method streamer for a method exposed by the proxy object to allow mapping from a generic cross-language type to a language-specific type, the object type comprising a unique string to identify the object type; binding the adapter object within a naming service by use of a name space class, wherein binding associates the adapter object to a URL, effective to enable the proxy object to access the adapter object; receiving, with the adapter object, a call from a first functionality through the proxy object; and responsive to receiving the call, calling the second functionality using the adapter object, the second functionality comprising a business object that includes at least one operation, the call to the second functionality comprising optional information to be passed to the at least one operation.
 14. The computer readable storage medium of claim 13, wherein the instructions cause the computing device to perform operations further comprising causing the first functionality, in a programming language, to perform operations within a second functionality that is in the programming language or in a different programming language.
 15. A system for enabling a client, in a programming language, to perform operations within a server, in the programming language or in a different programming language, the system comprising: a server including a computer readable storage medium, the server configured to be coupled to a client that contains a proxy object; means, embodied on the computer readable storage medium, for creating an adapter object for the server; means, embodied on the computer readable storage medium, for binding the adapter object to a URL within a naming service, by use of a name space class configured to resolve the naming service, effective to enable the proxy object to access the adapter object, the proxy object configured to register both an object type within a run time and a method streamer for a method exposed by the proxy object to allow mapping from a generic cross-language type to a language-specific type, the object type comprising a unique string to identify the object type; means, embodied on the computer readable storage medium, for receiving, with the adapter object, a call from the client through the proxy object, the proxy object being associated with the adapter object; and means, embodied on the computer readable storage medium, for calling, responsive to receiving the call, an operation on the server using the adapter object.
 16. The system of claim 15, wherein the server comprises a business object.
 17. The system of claim 16, wherein the business object comprises at least one operation.
 18. The system of claim 15, wherein the means for using the adapter object to call an operation on the server further comprises: means, embodied on the computer readable storage medium, for calling the operation with optional information to be passed to the operation; and means, embodied on the computer readable storage medium, for mapping a name of the operation to the operation prior to receiving a call from the proxy object.
 19. The system of claim 18, wherein the optional information includes arguments to the operation.
 20. The system of claim 19, wherein the operation comprises a business method.
 21. The system of claim 15, wherein the adapter object and the operation on the server are instances of classes.
 22. The system of claim 21, wherein the classes are in the same programming language.
 23. The system of claim 15, wherein the proxy object and the client are instances of classes.
 24. The system of claim 23, wherein the classes are in the same programming language.
 25. The system of claim 15, wherein the means for binding includes means, embodied on the computer readable storage medium, for associating the adapter object to the URL within the naming service.
 26. A system for performing operations by a client in a programming language within a server in the programming language or in a different programming language, comprising; a computer readable storage medium; an adapter object, embodied on the computer-readable storage medium on a computing device, that is bound to a URL by use of a name space class, within a naming service effective to enable a proxy object to access the adapter object, the proxy object configured to register both an object type within a run time and a method streamer for a method exposed by the proxy object to allow mapping from a generic cross-language type to a language-specific type, the object type comprising a unique string to identify the object type; and the server being configured to receive a call from the proxy object that is associated with the adapter object, the call from the proxy object at the client being a static invocation that is passed to the naming service by the name space class responsive to a resolution of the naming service by the name space class.
 27. A method for a first functionality in a programming language to perform operations within a second functionality in the programming language or in a different programming language, the method comprising: looking-up a proxy object, on a computing device, for an adapter object that is associated with the second functionality and is configured to call the second functionality by mapping a name of an operation to the operation prior to receiving a call from the proxy object; calling the proxy object using a lookup invocation via the first functionality; registering both an object type within a run time and a method streamer for a method exposed by the proxy object to allow mapping from a generic cross-language type to a language-specific type, the object type comprising a unique string to identify the object type; using the proxy object to access the adapter object through a naming service in which the adapter object is bound to a URL by use of a name space class configured to resolve the naming service and transfer the lookup invocation to the naming service; and calling the adapter object using the proxy object effective to cause the adapter object to call the second functionality.
 28. A method for a first functionality in a programming language to perform operations within a second functionality in the programming language or in a different programming language, the method comprising: looking-up a proxy object, on a computing device, for an adapter object that is associated with the second functionality and is configured to call the second functionality by mapping a name of an operation to the operation prior to receiving a call from the proxy object; calling the proxy object using the first functionality; registering both an object type within a run time and a method streamer for a method exposed by the proxy object to allow mapping from a generic cross-language type to a language-specific type, the object type comprising a unique string to identify the object type; using the proxy object to access the adapter object through a URL to which the adapter object is bound by use of a name space class configured to resolve the naming service and transfer the lookup invocation to the naming service; and calling the adapter object using the proxy object effective to cause the adapter object to call the second functionality in the different programming language.
 29. A computer readable storage medium comprising instructions which, responsive to execution on a computing device, cause the computing device to perform operations comprising: looking-up a proxy object for an adapter object based on a URL with which the adapter object is associated within a naming service in which the adapter object is bound by use of a name space class, wherein the adapter object is associated with a second functionality and is configured to call the second functionality by mapping a name of an operation to the operation prior to receiving a call from the proxy object; exposing the proxy object to a first functionality; calling the proxy object using the first functionality; registering both an object type within a run time and a method streamer for a method exposed by the proxy object to allow mapping from a generic cross-language type to a language-specific type, the object type comprising a unique string to identify the object type; and calling the adapter object using the proxy object effective to cause the adapter object to call an operation in the second functionality with a call that includes optional information to be passed to the operation.
 30. A system for enabling a client, in a programming language, to perform operations within a server, in the programming language or in a different programming language, the system comprising: a client including a computer readable storage medium, the client configured to be coupled to a server that comprises an adapter object which is configured to call an operation on the server by mapping a name of the operation to the operation prior to receiving a call from a proxy object, the call comprising a static invocation using a name space class that contains one or more static methods for naming service operations; means, embodied on the computer readable storage medium, for looking-up the proxy object for the adapter object; means, embodied on the computer readable storage medium, for calling the proxy object using the client; means, embodied on the computer readable storage medium, for registering both an object type within a run time and a method streamer for a method exposed by the proxy object to allow mapping from a generic cross-language type to a language-specific type, the object type comprising a unique string to identify the object type; means, embodied on the computer readable storage medium, for using the proxy object to access the adapter object through a naming service in which the adapter object is bound by use of the name space class; and means, embodied on the computer readable storage medium, for calling the adapter object using the proxy object effective to cause the adapter object to call the server. 